<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>08.常用api.html</title>
</head>
<body>

    <div></div>
    <div></div>
    <div></div>

    <script>
        /**
         * 静态方法  from  伪数组转为真实数组
         *          isArray 判断是否是一个数组 
         *          of  将可变数值转为数组
         */
         // console.dir(Array);

         const {isArray,from,of}   = Array;

         

         const divNodes = document.querySelectorAll("div");
         // console.log(divNodes);

         console.log(divNodes instanceof Array);  // false

         // console.log(Array.isArray(divNodes));
         console.log(isArray(divNodes));

         const divNodeArray = [...divNodes]
         const divNodeArray02 = from(divNodes)
         
         console.log(isArray(divNodeArray));
         console.log(isArray(divNodeArray02));
         console.log("===================================");

         const myArray = {
             0:"夏明1",
             1:"夏明2",
             2:"夏明3",
             length:3
         }
         const myArray01 = from(myArray)
         console.log(isArray(myArray01));
         console.log("================");
         const cities = of("北京","上海","广州")
         console.log(isArray(cities));
         console.log(cities);

         console.log("========================");
         const myArray02 = [10,20,30,40]
         // 将数组的每个元素都+10  并且返回一个新的数组
        //  const newArray =  myArray02.map(function(value) {
        //     return value + 10;
        //  })

         const newArray =  myArray02.map(value => value + 10)
         console.log(newArray);

       
    </script>
    
</body>
</html>